﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace FileEfCore.Migrations.ServerFileDb
{
    public partial class v12 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Files");

            migrationBuilder.CreateTable(
                name: "FileStorageRecord",
                columns: table => new
                {
                    FileStorageRecordOID = table.Column<Guid>(type: "TEXT", nullable: false),
                    ID = table.Column<string>(type: "TEXT", nullable: false),
                    Caption = table.Column<string>(type: "TEXT", nullable: false),
                    Actualfilename = table.Column<string>(type: "TEXT", nullable: false),
                    FileStoragePath = table.Column<string>(type: "TEXT", nullable: false),
                    FileExtension = table.Column<string>(type: "TEXT", nullable: false),
                    PreviewfilePath = table.Column<string>(type: "TEXT", nullable: true),
                    SYS_Created = table.Column<DateTime>(type: "TEXT", nullable: false),
                    Isiteffective = table.Column<bool>(type: "INTEGER", nullable: false),
                    DownloadServiceAddress = table.Column<string>(type: "TEXT", nullable: true),
                    DownloadServicePort = table.Column<int>(type: "INTEGER", nullable: true),
                    UploadServiceAddress = table.Column<string>(type: "TEXT", nullable: true),
                    UploadServicePort = table.Column<int>(type: "INTEGER", nullable: true),
                    StorageID = table.Column<string>(type: "TEXT", nullable: true),
                    Storageprotocol = table.Column<string>(type: "TEXT", nullable: true),
                    StorageServiceAddress = table.Column<string>(type: "TEXT", nullable: true),
                    StorageServicePort = table.Column<int>(type: "INTEGER", nullable: true),
                    Version = table.Column<string>(type: "TEXT", nullable: true),
                    ParentOID = table.Column<Guid>(type: "TEXT", nullable: false),
                    SYS_LAST_UPD = table.Column<DateTime>(type: "TEXT", nullable: false),
                    FileHash = table.Column<string>(type: "TEXT", nullable: false),
                    FileSize = table.Column<string>(type: "TEXT", nullable: false),
                    FileServerRegistration_ID = table.Column<string>(type: "TEXT", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FileStorageRecord", x => x.FileStorageRecordOID);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "FileStorageRecord");

            migrationBuilder.CreateTable(
                name: "Files",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    DownCount = table.Column<int>(type: "INTEGER", nullable: false),
                    FileLength = table.Column<long>(type: "INTEGER", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
                    LocalFileName = table.Column<string>(type: "varchar(1000)", nullable: false),
                    MD5Hash = table.Column<string>(type: "TEXT", nullable: false),
                    OperationDateTime = table.Column<DateTime>(type: "TEXT", nullable: false),
                    ProgressRate = table.Column<double>(type: "REAL", nullable: false),
                    ProgressStatus = table.Column<int>(type: "INTEGER", nullable: false),
                    Remark = table.Column<string>(type: "TEXT", nullable: true),
                    ServerFileName = table.Column<string>(type: "varchar(1000)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Files", x => x.Id);
                });
        }
    }
}
